from header_common import *
from header_parties import *
from ID_troops import *
from ID_factions import *
from ID_party_templates import *
from ID_map_icons import *

####################################################################################################################
#  Each party record contains the following fields:
#  1) Party id: used for referencing parties in other files.
#     The prefix p_ is automatically added before each party id.
#  2) Party name.
#  3) Party flags. See header_parties.py for a list of available flags
#  4) Menu. ID of the menu to use when this party is met. The value 0 uses the default party encounter system.
#  5) Party-template. ID of the party template this party belongs to. Use pt_none as the default value.
#  6) Faction.
#  7) Personality. See header_parties.py for an explanation of personality flags.
#  8) Ai-behavior
#  9) Ai-target party
# 10) Initial coordinates.
# 11) List of stacks. Each stack record is a triple that contains the following fields:
#   11.1) Troop-id. 
#   11.2) Number of troops in this stack. 
#   11.3) Member flags. Use pmf_is_prisoner to note that this member is a prisoner.
####################################################################################################################

no_menu = 0
#pf_town = pf_is_static|pf_always_visible|pf_hide_defenders|pf_show_faction
pf_town = pf_is_static|pf_always_visible|pf_show_faction

sample_party = [(trp_swadian_knight,60,0), (trp_swadian_peasant,1000,0), (trp_swadian_crossbowman,100,0), (trp_swadian_man_at_arms, 100, 0), (trp_swadian_footman, 150, 0), (trp_swadian_militia,500,0)]

parties = [
  ("main_party","main_party",icon_player|pf_limit_members, no_menu, pt_none,fac_player_faction,0,ai_bhvr_hold,0,(10,  46.26),[(trp_player,1,0)]),
  ("temp_party","temp_party",pf_disabled, no_menu, pt_none, fac_commoners,0,ai_bhvr_hold,0,(0,0),[]),
  ("camp_bandits","camp_bandits",pf_disabled, no_menu, pt_none, fac_outlaws,0,ai_bhvr_hold,0,(1,1),[(trp_unarmed_troop,3,0)]),
#parties before this point are hardwired. Their order should not be changed.

  ("temp_party_2","temp_party_2",pf_disabled, no_menu, pt_none, fac_commoners,0,ai_bhvr_hold,0,(0,0),[]),
#Used for calculating casulties.
  ("temp_casualties","casualties",pf_disabled, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(1,1),[]),
  ("temp_casualties_2","casualties",pf_disabled, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(1,1),[]),
  ("temp_casualties_3","casualties",pf_disabled, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(1,1),[]),
  ("temp_wounded","enemies_wounded",pf_disabled, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(1,1),[]),
  ("temp_killed", "enemies_killed", pf_disabled, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(1,1),[]),
  ("main_party_backup","_",  pf_disabled, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(1,1),[]),
  ("encountered_party_backup","_",  pf_disabled, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(1,1),[]),
  ("ally_party_backup","_",  pf_disabled, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(1,1),[]),

  ("collective_enemy","collective_enemy",pf_disabled, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(1,1),[]),
  ("collective_ally","collective_ally",pf_disabled, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(1,1),[]),


  ("zendar_mercs","zendar_mercs",pf_disabled, no_menu, pt_none, fac_commoners,0,ai_bhvr_hold,0,(0,0),[(trp_farmer,15,0)]),

  ("town_1_mercs","sargoth_mercs",pf_disabled, no_menu, pt_none, fac_swadians,0,ai_bhvr_hold,0,(0,0),[(trp_swadian_peasant,5,0)]),
  ("town_2_mercs","tihr_mercs",pf_disabled, no_menu, pt_none, fac_swadians,0,ai_bhvr_hold,0,(0,0),[(trp_swadian_peasant,5,0)]),
  ("town_3_mercs","veluca_mercs",pf_disabled, no_menu, pt_none, fac_swadians,0,ai_bhvr_hold,0,(0,0),[(trp_swadian_peasant,5,0)]),
  ("town_4_mercs","suno_mercs",pf_disabled, no_menu, pt_none, fac_swadians,0,ai_bhvr_hold,0,(0,0),[(trp_swadian_peasant,5,0)]),
  ("town_5_mercs","jelkala_mercs",pf_disabled, no_menu, pt_none, fac_swadians,0,ai_bhvr_hold,0,(0,0),[(trp_swadian_peasant,5,0)]),
  ("town_6_mercs","praven_mercs",pf_disabled, no_menu, pt_none, fac_swadians,0,ai_bhvr_hold,0,(0,0),[(trp_swadian_peasant,5,0)]),
  ("town_7_mercs","uxkhal_mercs",pf_disabled, no_menu, pt_none, fac_swadians,0,ai_bhvr_hold,0,(0,0),[(trp_swadian_peasant,5,0)]),

  ("town_8_mercs","reyvadin_mercs",pf_disabled, no_menu, pt_none, fac_vaegirs,0,ai_bhvr_hold,0,(0,0),[(trp_vaegir_peasant,5,0)]),
  ("town_9_mercs","khudan_mercs",pf_disabled, no_menu, pt_none, fac_vaegirs,0,ai_bhvr_hold,0,(0,0),[(trp_vaegir_peasant,5,0)]),
  ("town_10_mercs","tulga_mercs",pf_disabled, no_menu, pt_none, fac_vaegirs,0,ai_bhvr_hold,0,(0,0),[(trp_vaegir_peasant,5,0)]),
  ("town_11_mercs","curaw_mercs",pf_disabled, no_menu, pt_none, fac_vaegirs,0,ai_bhvr_hold,0,(0,0),[(trp_vaegir_peasant,5,0)]),
  ("town_12_mercs","wercheg_mercs",pf_disabled, no_menu, pt_none, fac_vaegirs,0,ai_bhvr_hold,0,(0,0),[(trp_vaegir_peasant,5,0)]),
  ("town_13_mercs","rivacheg_mercs",pf_disabled, no_menu, pt_none, fac_vaegirs,0,ai_bhvr_hold,0,(0,0),[(trp_vaegir_peasant,5,0)]),
  ("town_14_mercs","halmar_mercs",pf_disabled, no_menu, pt_none, fac_vaegirs,0,ai_bhvr_hold,0,(0,0),[(trp_vaegir_peasant,5,0)]),
  
  ("zendar","Zendar",icon_town|pf_is_static|pf_always_visible|pf_hide_defenders, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(2,46),[(trp_swadian_knight,6,0)]),

  ("town_1","Sargoth",  icon_town|pf_town|pf_hide_defenders, no_menu, pt_none, fac_swadians,0,ai_bhvr_hold,0,(-42,34),sample_party),
  ("town_2","Tihr",     icon_town|pf_town|pf_hide_defenders, no_menu, pt_none, fac_swadians,0,ai_bhvr_hold,0,(-19,65),sample_party),
  ("town_3","Veluca",   icon_town|pf_town|pf_hide_defenders, no_menu, pt_none, fac_swadians,0,ai_bhvr_hold,0,(-27,-50),sample_party),
  ("town_4","Suno",     icon_town|pf_town|pf_hide_defenders, no_menu, pt_none, fac_swadians,0,ai_bhvr_hold,0,(-24,-11),sample_party),
  ("town_5","Jelkala",  icon_town|pf_town|pf_hide_defenders, no_menu, pt_none, fac_swadians,0,ai_bhvr_hold,0,(-54,-22),sample_party),
  ("town_6","Praven",   icon_town|pf_town|pf_hide_defenders, no_menu, pt_none, fac_swadians,0,ai_bhvr_hold,0,(-17,20),sample_party),
  ("town_7","Uxkhal",   icon_town|pf_town|pf_hide_defenders, no_menu, pt_none, fac_swadians,0,ai_bhvr_hold,0,(-2,-8),sample_party),

  ("town_8","Reyvadin", icon_town|pf_town|pf_hide_defenders, no_menu, pt_none, fac_vaegirs,0,ai_bhvr_hold,0,(25,-17),[(trp_vaegir_knight,6,0)]),
  ("town_9","Khudan",   icon_town_snow|pf_town|pf_hide_defenders, no_menu, pt_none, fac_vaegirs,0,ai_bhvr_hold,0,(48,37),[(trp_vaegir_knight,6,0)]),
  ("town_10","Tulga",   icon_town|pf_town|pf_hide_defenders, no_menu, pt_none, fac_vaegirs,0,ai_bhvr_hold,0,(56,-34),[(trp_vaegir_knight,6,0)]),
  ("town_11","Curaw",   icon_town_snow|pf_town|pf_hide_defenders, no_menu, pt_none, fac_vaegirs,0,ai_bhvr_hold,0,(45,-6),[(trp_vaegir_knight,6,0)]),
  ("town_12","Wercheg", icon_town|pf_town|pf_hide_defenders, no_menu, pt_none, fac_vaegirs,0,ai_bhvr_hold,0,(27,68),[(trp_vaegir_knight,6,0)]),
  ("town_13","Rivacheg",icon_town|pf_town|pf_hide_defenders, no_menu, pt_none, fac_vaegirs,0,ai_bhvr_hold,0,(13,21),[(trp_vaegir_knight,6,0)]),
  ("town_14","Halmar",  icon_town|pf_town|pf_hide_defenders, no_menu, pt_none, fac_vaegirs,0,ai_bhvr_hold,0,(-4,-37),[(trp_vaegir_knight,6,0)]),

  ("castle_1","Culmarr_Castle",icon_castle_a|pf_is_static|pf_always_visible, no_menu, pt_none, fac_outlaws,0,ai_bhvr_hold,0,(-47,-51),[(trp_swadian_knight,5,0),(trp_swadian_crossbowman,25,0)]),
  ("castle_2","Radoghir_Castle",icon_castle_a|pf_is_static|pf_always_visible, no_menu, pt_none, fac_outlaws,0,ai_bhvr_hold,0,(37,-31),[(trp_vaegir_knight,5,0),(trp_vaegir_archer,26,0)]),
  ("castle_3","castle_3",pf_disabled|icon_castle_a|pf_is_static|pf_always_visible, no_menu, pt_none, fac_outlaws,0,ai_bhvr_hold,0,(17,11),[]),
  ("castle_4","castle_4",pf_disabled|icon_castle_a|pf_is_static|pf_always_visible, no_menu, pt_none, fac_outlaws,0,ai_bhvr_hold,0,(-24,16),[]),
  ("castle_5","castle_5",pf_disabled|icon_castle_a|pf_is_static|pf_always_visible, no_menu, pt_none, fac_outlaws,0,ai_bhvr_hold,0,(-5,36),[]),
  ("castle_6","castle_6",pf_disabled|icon_castle_a|pf_is_static|pf_always_visible, no_menu, pt_none, fac_outlaws,0,ai_bhvr_hold,0,(5,26),[]),
  ("castle_7","castle_7",pf_disabled|icon_castle_a|pf_is_static|pf_always_visible, no_menu, pt_none, fac_outlaws,0,ai_bhvr_hold,0,(46,-6),[]),
  ("castle_8","castle_8",pf_disabled|icon_castle_a|pf_is_static|pf_always_visible, no_menu, pt_none, fac_outlaws,0,ai_bhvr_hold,0,(32,-17),[]),

  ("salt_mine","Salt_Mine",icon_village_a|pf_is_static|pf_always_visible|pf_hide_defenders, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(14.2, -31),[(trp_swadian_knight,6,0)]),
  ("four_ways_inn","Four_Ways_Inn",icon_village_a|pf_is_static|pf_always_visible|pf_hide_defenders, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(4.8, -19.6),[(trp_swadian_knight,6,0)]),
  ("dhorak_keep","Dhorak_Keep",icon_town|pf_is_static|pf_always_visible|pf_no_label|pf_hide_defenders, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(-50,-58),[(trp_swadian_knight,6,0)]),

  ("training_ground","Training Ground",  icon_village_a|pf_hide_defenders|pf_is_static|pf_always_visible, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(10,47),[]),


  ("river_pirate_spawn_point"   ,"river_pirate_sp",pf_disabled|pf_is_static, no_menu, pt_none, fac_outlaws,0,ai_bhvr_hold,0,(6, 54.3),[(trp_river_pirate,15,0)]),
  ("steppe_bandit_spawn_point"  ,"steppe_bandit_sp",pf_disabled|pf_is_static, no_menu, pt_none, fac_outlaws,0,ai_bhvr_hold,0,(-33, -39.3),[(trp_river_pirate,15,0)]),
  ("black_khergit_spawn_point"  ,"black_khergit_sp",pf_disabled|pf_is_static, no_menu, pt_none, fac_outlaws,0,ai_bhvr_hold,0,(47.1, -43.3),[(trp_river_pirate,15,0)]),
  ("forest_bandit_spawn_point"  ,"forest_bandit_sp",pf_disabled|pf_is_static, no_menu, pt_none, fac_outlaws,0,ai_bhvr_hold,0,(-24.1, 11),[(trp_river_pirate,15,0)]),
  ("mountain_bandit_spawn_point","mountain_bandit_sp",pf_disabled|pf_is_static, no_menu, pt_none, fac_outlaws,0,ai_bhvr_hold,0,(24.1, 11),[(trp_river_pirate,15,0)]),
  ("sea_raider_spawn_point_1"   ,"sea_raider_sp",pf_disabled|pf_is_static, no_menu, pt_none, fac_outlaws,0,ai_bhvr_hold,0,(-32.6, 63),[(trp_river_pirate,15,0)]),
  ("sea_raider_spawn_point_2"   ,"sea_raider_sp",pf_disabled|pf_is_static, no_menu, pt_none, fac_outlaws,0,ai_bhvr_hold,0,(39.6, 66),[(trp_river_pirate,15,0)]),
 # add extra towns before this point 
  ("spawn_points_end"                  ,"last_spawn_point",    pf_disabled|pf_is_static, no_menu, pt_none, fac_commoners,0,ai_bhvr_hold,0,(0., 0),[(trp_river_pirate,15,0)]),
]
